package day16.FanSe.FS04;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Text02 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
        Class<?> aClass = Class.forName("day16.FanSe.FS04.Student");
        Method method = aClass.getMethod("function4", String.class);
        //3.运行function4方法就可以了
//3.1创建一个Student对象,当做方法的调用者
        Student student = (Student) aClass.newInstance();
        //3.2运行方法
        Object o = method.invoke(student, "zhangsan");
        System.out.println(o);
    }
}
